package com.lijz.config;

import com.baomidou.mybatisplus.core.injector.ISqlInjector;
import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@MapperScan("com.lijz.**.mapper")
public class MybatisPlusConfig {
	/*
    * 分页插件，自动识别数据库类型
    * 多租户，请参考官网【插件扩展】
    */
	@Bean
	public PaginationInterceptor paginationInterceptor() {
		return new PaginationInterceptor();
	}

	/**
	 * 自动写入创建人，创建时间，修改人，修改时间
	 */
//	@Bean
//	public AutoDateInterceptor auditingInterceptor() {
//		AutoDateInterceptor autoDateInterceptor = new AutoDateInterceptor();
//		return autoDateInterceptor;
//	}

	/**
	 * 逻辑删除
	 */
	@Bean
	public ISqlInjector sqlInjector() {
		return new LogicSqlInjector();
	}
}
